<?php
namespace app\admin\controller;

use app\BaseController;
use Swoole\Server;
use think\facade\View;
class Index extends BaseController
{
    public function index()
    {
        return View::fetch('index');
    }
    public function indext()
    {
        return View::fetch('indext');
    }
    public function sends(Server $server)
    {
        $uid = $this->request->param('uid','123');
        $content = $this->request->param('content','测试发送');
        $to = $this->request->param('to','23423');
//        dump($server);
//        $server->task(['cmd'=>'lottery','content'=>'测试发送']);
        $server->task(['cmd'=>'lottery','content'=>'测试发送']);
        event('swoole.websocket.Point', ['api' => true,'uid'=>$uid, 'to' => $to, 'content' =>$content ]);
    }
    public function gitpull(){
        if(function_exists("shell_exec")){
            $cute =  "cd /www/wwwroot/tp && git pull https://gitee.com/kx09/swoole.git 1>&2";
//            dump($cute);die;
            //wrewerwerwrew
            $exe = exec($cute,$callback);
            dump($callback);
            return "下拉完成-".date('Y-m-d H:i:s');
        }else{
            return '系统配置：shell_exec函数不可用';
        }
    }
    public function add()
    {
        $a = '2323423';
        $a = '2323423';
        $a = '2323423';
        $a = '2323423';
        $a = '2323423';
        var_dump($a);die;
    }
}